package com.wbc.utils.imageUtil;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;

/**
 * @author 389561407@qq.com
 * @version 1.0
 * @since 2022-12-26
 */
public class ImageHistogramUtil {

    private static ImageHistogram histogram = new ImageHistogram();
    private static File file = new File("C:\\Users\\Administrator\\Desktop\\demo\\"); //样品


    public static int getNum(BufferedImage image) {
        File[] files = file.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                return name.endsWith(".png");
            }
        });
        for (File file1 : files) {
            double score  = 0;
            try {
                score = histogram.match(image, file1);
            } catch (IOException e) {
                e.printStackTrace();
            }
            System.out.println("img1-->img1::::score : " + score);
            if(score > 1){
                System.out.println(file1.getName());
            }
        }
        return 0;
    }
}
